From 69bcfee699cb7a65b59882e35aa4f4de1ab9c289 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 19 Mar 2004 14:49:10 +0000 Subject: [PATCH] bitkeeper revision 1.812 (405b0866daZJ0BPWPFHFWqcf9thiBA) utils.c: Autocreate /dev/xen/evtchn when starting xend, if it doesn't exist already. --- tools/xend/lib/utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/xend/lib/utils.c b/tools/xend/lib/utils.c index 24064b6a45..07cba257f5 100644 --- a/tools/xend/lib/utils.c +++ b/tools/xend/lib/utils.c @@ -129,9 +129,15 @@ static PyObject *xu_notifier_new(PyObject *self, PyObject *args) xun = PyObject_New(xu_notifier_object, &xu_notifier_type); + reopen: xun->evtchn_fd = open(EVTCHN_DEV_NAME, O_NONBLOCK|O_RDWR); if ( xun->evtchn_fd == -1 ) { + if ( (errno == ENOENT) && + ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) && + (mknod(EVTCHN_DEV_NAME, S_IFCHR|0600, + (EVTCHN_DEV_MAJOR << 8) | EVTCHN_DEV_MINOR) == 0) ) + goto reopen; PyObject_Del((PyObject *)xun); return PyErr_SetFromErrno(PyExc_IOError); } -- 2.30.2